#*=+--+=#=+--     Unmanned Aerial System Management Software      --+=#=+--+=#*#
#          Copyright (C) 2011 Regents of the University of Colorado.           #
#                             All Rights Reserved.                             #
#                                                                              #
#    This program is free software: you can redistribute it and/or modify      #
#    it under the terms of the GNU General Public License version 2 as         #
#    published by the Free Software Foundation.                                #
#                                                                              #
#    This program is distributed in the hope that it will be useful,           #
#    but WITHOUT ANY WARRANTY; without even the implied warranty of            #
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             #
#    GNU General Public License for more details.                              #
#                                                                              #
#    You should have received a copy of the GNU General Public License         #
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     #
#                                                                              #
#           Jack Elston                       Cory Dixon                       #
#           elstonj@colorado.edu              dixonc@colorado.edu              #
#                                                                              #
#*=+--+=#=+--                 --+=#=+--+=#=+--                    --+=#=+--+=#*#

#--------------------------------------------------------------------- 
#
# Makefile 
#   for Avionics Project
#
# This file needs the Makefile.include file which contains
# all of the file dependecies for the directory of which
# it is in.
#
# Author: Cory Dixon
#
#--------------------------------------------------------------------- 

ifdef DEBUG
  DBPRINT = -DDEBUG_PRINT
endif


#--------------------------------------------------------------------- 
# default - executable files
#--------------------------------------------------------------------- 
default: exe

#---------------------------------------------------------------------
# Makefile.include
# include directory specific makefile
#---------------------------------------------------------------------
include Makefile.include

VPATH = $(DIRS) 
INCDIR = $(DIRS) 

#---------------------------------------------------------------------
# macros
#---------------------------------------------------------------------
INCLUDES  = $(addprefix -I,$(INCDIR)) -I.
CC        = gcc
CXX       = g++
FLAGS     = -g -D_REENTRANT -Wall $(DBPRINT) $(INCLUDES) -Wno-deprecated 
CFLAGS    = $(FLAGS)
CXXFLAGS  = $(FLAGS)
LIBDIR    = -L/usr/local/glut/lib -L/usr/X11R6/lib
LDLIBS    = -lpthread -lrt #-lplibjs -lplibul #-lncurses 

#--------------------------------------------------------------------- 
# Executable files
#--------------------------------------------------------------------- 
exe: $(PROGS)


#---------------------------------------------------------------------
# Inference rules for executables
#---------------------------------------------------------------------
$(PROGS): 
	$(CXX) $^ $(LIBDIR) $(LDLIBS) -o $@ 

#---------------------------------------------------------------------
# Inference rules for objects from files with a .cxx extension
#---------------------------------------------------------------------
% : %.cxx %.h
	$(CXX) $(CXXFLAGS) $(LIBDIR) $(LDLIBS) $< -o $@
% : %.cxx 
	$(CXX) $(CXXFLAGS) $(LIBDIR) $(LDLIBS) $< -o $@
%.o : %.cxx %.h
	$(CXX) $(CXXFLAGS) -c $< -o $@
%.o : %.cpp %.h
	$(CXX) $(CXXFLAGS) -c $< -o $@
%.o : %.cxx
	$(CXX) $(CXXFLAGS) -c $< -o $@
%.o : %.cpp
	$(CXX) $(CXXFLAGS) -c $< -o $@
#$(CXX) $(CXXFLAGS) -c $< -o obj/$@

#--------------------------------------------------------------------- 
# Clean 
#--------------------------------------------------------------------- 
clean: 
	rm -f *.o core* *.out *.dat *.log
allclean: clean
	rm -f $(PROGS)
